home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include <assert.h>
- #include <system.h>
- #include <string.h>
- #include <time.h>
-
- void xroot();
-
- int main(int argc, char **argv)
- {
- int i;
-
- printf("start of command line parameters, argc=%d\n",argc);
- for(i=0; i<argc; i++)
- printf("[%d][%s]\n",i,argv[i]);
- printf("end of command line parameters\n");
-
- xroot();
- }
-
- void xroot()
- {
- int i,j;
- char *p[10], buf[150];
- struct REGS ireg,oreg;
-
- printf("==> starting xroot <==\n");
-
- // --- try out getenv
- printf("COMSPEC\t=>%s<=\n",getenv("COMSPEC")); assert(strlen(getenv("COMSPEC"))>0);
- printf("PROMPT\t=>%s<=\n",getenv("PROMPT")); assert(strlen(getenv("PROMPT"))>0);
- printf("passed getenv...\n");
-
- // --- now try malloc and free
- for(i=0; i<10; i++)
- {
- p[i]=malloc((j=rand() & 0xfff));
- printf("%d,%d,%p\t",i,j,p[i]);
- }
-
- for(i=0; i<10; i++)
- free(p[i]);
-
- p[0]=malloc(100); printf("\nnew malloc=%p\n",p[0]); free(p[0]);
-
- // --- test int86
- ireg.ax=0x4700; /* getcd */
- ireg.dx=0; /* c drive */
- ireg.si=(unsigned)buf;
- int86(0x21,&ireg,&oreg);
- printf("getcd ->%s<-\n",buf);
-
- printf("bios_clock; %lu;",bios_clock());
- sleep(2L);
- printf(" (+2 sec) %lu;\n",bios_clock());
-
- printf("please press an alphabetic key...");
- while(!kbhit()) { sleep(1L); printf("."); }
- printf("%c.\n",getch());
-
- printf("please press another alphabetic key...");
- while(!kbhit()) { sleep(1L); printf("."); }
- printf("%c.\n",getche());
-
- printf("passed root tests...\n");
- printf("==> finished xroot <==\n");
-
- return;
- }
-